package com.learn.project2.controller.admin;

import com.learn.project2.bean.MarketUser;
import com.learn.project2.model.bo.admin.user.UserListBO;
import com.learn.project2.model.vo.admin.user.UserListVO;

import com.learn.project2.service.admin.user.UserService;
import com.learn.project2.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @description: 会员管理
 * @author wxy
 * @date 2022-01-09 20:40
 * @version 1.0
 */
@RestController
@RequestMapping("admin/user")
public class UserController {


    @Autowired
    UserService userService;
    @RequestMapping("list")
    public Result list(String username,Integer id,String mobile,UserListBO userListBO){
        UserListVO userListVO = userService.selectUser(username,id,mobile,userListBO);
        return Result.ok(userListVO);
    }

    @RequestMapping("detail")
    public Result detail(Integer id){
        MarketUser marketUser = userService.selectUserById(id);
         return Result.ok(marketUser);
    }

    @PostMapping("update")
    public Result update(@RequestBody MarketUser marketUser){
        Integer rows = userService.updateUser(marketUser);
        return Result.ok(rows);
    }
}
